package com.hdoit.ares.selfcommon.utils;

import java.util.Date;

import com.xiaoleilu.hutool.date.DateUtil;

public class DateBetween {
	public static String dateBetween(Date time, Date startTime, Date endtime) {

		long starTimeLong = startTime.getTime();
		long endTimeLong = endtime.getTime();
		long timeLong = time.getTime();
		String a = null;
		if (timeLong < starTimeLong) {
			a= "below";
		}
		if (timeLong > starTimeLong && timeLong < endTimeLong) {
			a= "between";
		}
		if (timeLong > endTimeLong) {
			a= "on";
		}
		return a;
	}
	
	public static String leftDate(Date time, Date startTime, Date endtime){
		long starTimeLong = startTime.getTime();
		long endTimeLong = endtime.getTime();
		long timeLong = time.getTime();
		String leftDate = "0";
		String sign = "-";
		if (timeLong < starTimeLong) {
			leftDate = sign + "_" + DateUtil.formatBetween(time,startTime);
		}
		if (timeLong > starTimeLong && timeLong < endTimeLong) {
			sign = "+";
			leftDate = sign + "_" + DateUtil.formatBetween(time,endtime);
		}
		if (timeLong > endTimeLong) {
			leftDate = "0";
		}	
		return leftDate;
	}
}
